#pragma once
#include <easyx.h>
#include "Scene.hpp"

extern Scene* menu_scene;
extern Scene* select_scene;
extern Scene* candidate_scene;
extern Scene* join_scene;
extern Scene* room_scene;
extern Scene* game_scene;

class SceneManager
{
public:
	enum SceneType
	{
		Menu,
		Select,
		Candidate,
		Join,
		Room,
		Game
	};

	SceneManager(){}

	void SetCurrentScene(Scene* scene_ptr)
	{
		_scene_ptr = scene_ptr;
		_scene_ptr->Start();
	}

	void SwitchTo(SceneType scene_type)
	{
		_scene_ptr->Quit();
		switch (scene_type)
		{
		case Menu: 
			SetCurrentScene(menu_scene);
			break;
		case Select:
			SetCurrentScene(select_scene);
			break;
		case Candidate:
			SetCurrentScene(candidate_scene);
			break;
		case Join:
			SetCurrentScene(join_scene);
			break;
		case Room:
			SetCurrentScene(room_scene);
			break;

		case Game: 
			SetCurrentScene(game_scene);
			break;
		default: break;
		}
	}

	void InPut(const ExMessage& msg)
	{
		_scene_ptr->GetEvent(msg);
	}

	void ProcessEvent()
	{
		_scene_ptr->ProcessEvent();
	}

	void Display()
	{
		_scene_ptr->Display();
	}

	const Scene* GetScene()
	{
		return _scene_ptr;
	}

	~SceneManager() {}

private:
	Scene* _scene_ptr = nullptr;
};